<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <style>
    .box {
      width: 200px;
      height: 200px;
      border: 5px solid #333;
      border-radius: 10px;
      margin-bottom: 20px;
    }
  </style>
</head>

<body>
  <div class="app">
    <div v-show="bool" class="box"></div>
    <div v-if="bool" class="box"></div>
  </div>
  <!-- 相同点:两者都可以显示和隐藏元素 -->
  <!-- 区别:
  1.v-show通过display属性来控制显示和隐藏
  2.v-if值为真时渲染元素,为假时移除元素     -->
  <script src="./vue.js"></script>
  <script>
    const app = new Vue({
      el: '.app',
      data: {
        bool: true
      }
    })
  </script>
</body>

</html>